#pragma once
#include "CXcpObjectBase.h"
#include "INotifyOnDeleteCallback.h"
#include "CXcpObjectThreadSafeAddRefPolicy.h"
#include "PALImageDecodeParams.h"



class DecodedImageCache :
	public CXcpObjectBase<INotifyOnDeleteCallback,CXcpObjectThreadSafeAddRefPolicy>
{

public: 
	static HRESULT Create(struct IInvalidateDecodedImageCacheCallback * pCallback, const struct PALImageDecodeParams & params, struct IPALSurface * pSurface, DecodedImageCache * * ppCache);
	const struct PALImageDecodeParams & GetDecodeParams();
	struct IPALSurface * GetSurface();
	virtual void OnDelete(void * token);

private: 
	DecodedImageCache();
	virtual ~DecodedImageCache();
	HRESULT Initialize(struct IInvalidateDecodedImageCacheCallback * pCallback, const struct PALImageDecodeParams & params, struct IPALSurface * pSurface);
	struct IInvalidateDecodedImageCacheCallback * m_pCallback;
	struct PALImageDecodeParams m_decodeParams;

	struct IPALSurface * m_pSurfaceNoRef;
};